import re

word = 'h29good34ok12'

# result = re.findall(r'\d+', word)
# print(result)

reslt2 = re.sub(r'\d', 'x', word)
reslt3 = re.sub(r'\d+', 'x', word)
print(reslt2)

# 正则表达式:使用非常简单的方法对字符串进行检索和替换的操作
# number=''
# numbers = []
# for w in word:
# 	if '0' <= w <= '9':
# 		number += w
# 	else:
# 		if number != '':
# 			numbers.append(number)
# 		number=''
#
# print(numbers)